perm filename MIXPLA.BIL[UP,DOC] blob sn#425833 filedate 1979-03-20 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00006 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	MIXPLA
C00004 00003	HOW TO RUN MIXPLA
C00009 00004	SPECIAL FEATURES
C00014 00005	AN EXAMPLE RUN
C00018 00006	CONTINUED
C00022 ENDMK
C⊗;
MIXPLA
	
is a PLAY file mixing program with the following capabilities:
	
1. Can take up to 15 simultaneous input files.
2. Accepts TTY input.
3. Has no limits on input or output file sizes.
4. Can handle correctly almost any PLAY file that MBOX or NEWMUS can understand.
5. can read or write onto UDP.
6. will read and retain lower case (in most cases).
7. Is not confused by arbitrary data formats (tabs,spaces,crlfs,form feeds etc.)
   (will throw away directory pages).
8. can parse expressions in P1 and P2 (of any depth of parenthesis nesting).
9. is small and fast.
10. will check for duplicate calls on reverb and ask if the user wants them kept.
11. will attempt to produce a reasonable header.
HOW TO RUN MIXPLA

MIXPLA should be almost self-explanatory.  If no extension is given in the
response to "File # → " MIXPLA will look for a file with that name and  an
extension "PLA", "SCR", "HED",  or "BOX" (in  that order).  Output  file's
default extension is "PLA". <CR> terminates file input.
	
"Begin Time", if specified, will be added to all begin times in the file.

If the user responds "TTY:"  or "tty:"  etc (upper and lower case are  not
problematical), then MIXPLA sets up a channel into the mix for the user to
type information to directly.  It will be treated exactly like file  input
(anything you can  say in a  file, you  can say here).   To terminate  TTY
input, type just ";" or "FINISH;".
	
If PASS←0 or PLAY is encountered during a play file, all subsequent  begin
times become begin time + maximum note duration before the PLAY  statement
(as is to  be expected.)  PASS←anything  else will be  handled exactly  as
though the user had said PASS←0;
	
Any section of a play file between the statement "DONT_SCAN;" and  "SCAN;"
will be omitted from the output play file.  Only works in the play section
(not header).
	
MIXPLA thinks something is an instrument call if it is of the form:

   Name Separaters Expression Separaters Expression AnyThing ;

where NAME is any legal SAIL identifier (of any length).

    SEPARATERS is any combination of  any number of the following  characters:
    Space, Form Feed, Carraige Return, Line Feed, Tab, Comma (1)

    EXPRESSION is any  legal expression involving  parentheses, +,-,*,/,↑,  or
    ABS (absolute value),  INT (greateset integer  less than or  equal to  its
    argument -- Int(9.9)=9 ), SIN (sine of argument in degrees), LOG  (natural
    logarithm) --  arguments  may  themselves  be  expressions.   Any  illegal
    operator ("COS" etc.) or  invalid expression (extra  ")" etc.) will  cause
    MIXPLA to send  that expression  directly to  the PLAY  file, without  any
    attempt to  parse it.   Set STATEMENT  (see  below) to  be warned  of  any
    occurrences of this.)	(Octal numbers are also ok -- "'").
	
MIXPLA thinks a file is of the form:
    HEADER
    "PLAY;"
    DATA
where the header part  is optional (as  is the PLAY  if the file  contains
only header information.   If there is  no PLAY, the  entire file will  be
assumed to be header information.)

The comment character "<" is a special case, in that it signals a  comment
that can end either with a ";" or with crlf.  (SCORE assumes the latter).
"∂" is handled similarly.
SPECIAL FEATURES

If "INSERT" occurs at any point followed by a file name, MIXPLA will  open
a channel to it (if possible), just as though it had been specified at the
start.  If the  insert takes place  after a "PLAY"  statement, all  header
information will be discarded  and the first begin  time will reflect  the
begin time  where it  was inserted  (as  though there  was an  extra  PLAY
statement -- thus if a file containing:

	PLAY;
	Simp 0 2;
	FINISH;

is inserted at time 25 in some other file, SIMP 25 2; will be the  result.
INSERTED files may call other INSERT themselves.  (This allows one to  use
MIXPLA to butt files end to end easily.)  Partial file name  specification
is ok,  or reading  inserted files  from UDP  etc.  Clever  use of  INSERT
should allow one to handle any number of input files in one run of  MIXPLA
(when a file has been completely read by MIXPLA, it releases its  channel,
thus freeing it  up for  an INSERTED file  elsewhere.)  N.B.  this is  not
identical to MBOX's INSERT,  wherein the calling  file is suspended  until
the end of the inserted file.

Begin Times  and  Durations  (P1  and P2) may  be  expressions,  involving
parentheses, *,-,↑,+, and  /.  There  is no  limit on  the nesting  depth.
(Order of precedence is  ↑, * /,  + -.Left to  right).  Octal numbers  are
accepted.  The operators ABS, LOG, INT, and SIN are also understood.
	
Multiple calls on any instrument with  the first three letters REV in  its
name will cause MIXPLA to ask if the user wants these deleted -- if "Y" is
the response, any  instrument call  that begins REV  (REVRB, REVERB  etc.)
will be thrown away, after the first instance.
	
In producing the mix output's header, MIXPLA sends only the first instance
of a setting of NPTIX,  NUTIX, SRATE, or OUTPUT.  It  makes a list of  all
function files needed and of all instrument names declared with  "COMMON".
No duplicate calls  should be  issued.  Note also  that a  comment in  the
header section introduced by "COMMENT" will be tossed out.  If you want it
to stay, use "∂" or "<".

If there were any demand for it, a PLAY file editor could rather easily be
added to MIXPLA,  allowing one to  change any parameters  according to  an
operation or expression (P3←1.2*P3*FREQ(P1/(100)) for instance would
scale P3 by the function FREQ and 1.2 over a time of 100 sec).  Tell BIL.

To find out  what MIXPLA  is doing  type "DEBUGME"  as a  response to  the
request  for  input  file.   "STATEME"  tells  about  statement  handling,
"OPERATI" tells about internal machinery.  ("DEBUGME" gives both).
	
MIXPLA sets up a circular, doubly  linked list of all input ports  (files
and tty: channels), circles through these looking for various things,  and
cuts out of the circle any port that has been fully read in, thus assuring
maximal efficiency.
	
Multiple page input files may cause a multiple page output file without a
header to be produced.
AN EXAMPLE RUN
	
Say you had the following three files to be mixed:
Q.PLA :

record wve ran;
nptix←256;
common f g h i;
play;
f  -10+(-20+31)*2 10;
play;
f  (((1))) (9↑(1-1)*10);
play;
f ( 144 / 2) * .125 - 1    	1;
insert pw;
play;
f ()  ,-()	;
play;
f (1-)   ()-;
play;
f log(8+abs(-sin(int(44.7+(.3*3))))) 20+log(1);
play;
f int(90.180)	(2+sin(90))↑.5;
play;
f (	log(9)	-	2) 10;
play;
f .02	1;
finish;

PW.PLA :

FUNC sam Bmrng left rght loop;
NPTIX ← 130;
FUNC sam bmrng;
NPTIX ← 180;
PLAY;
reverb 0 100;
  Trem  5 21 14  485.8 2  14 .5  30  20  1.4,"inharm",.007, 0, "trplfm","dipp", .03;
Quad   10 14  242.9   1.6  env,"inharm", loop_ch1   .005    0;
Trem  37 21 7  296.1   2  7 .5  300  15  1.6 ,"harm",.007, 0, "Trplfm","envl", .02;
Trem  43 14 7  199.26  2  7 .5  0  15  1.6 ,"inharm",.004, 0, "Trplfm",1 .06;

∂ end cycle 1 (P0);

mot 0+58 21 a/2.18 7 .6  60  3  1.2  0 ,"harm", .009 0, "trplfm", "tuneRhy", 
	"tune", "louder", 1 .03;
mot 17.5+58 17.5 268.18 7 .8  120 3  1.2 1 ,"harm", .01  0, "trplfm", "tuneRhy", 
	"tune", "louder", "envl", .05;
entr  85+0 21   880   14 .8  0 3  1.2 1.8  1,"inharm", .015  0, "randfm", 
	"tunerhy", "tune", "louder", 2  .04;
entr  85+52.5  21 462.33  14  1  180 3  1.2 1.8  1,"inharm", .015  0, "randfm", 
	"tunerhy", "tune", "softer", 2  .04;
∂ end cycle 4 (I1);
FINISH;


TOOT.SCR:


FUNC EXMP1.FUN[INS,MUS]; 
COMMON TOOT INSA;   
 
  < TOOT .SCR  --  RANDOM NUMBER=     1
 PLAY;
 REVRB    0.000   10.000   0.000   0.000   0.000   0.000
;PRINT P1;< REVRB   1
 INSA     0.000    1.000 900.787   0.100    F1   0.000   0.000   0.000   0.000  45.000
         1.000   0.050    F6
;PRINT P1;< INSA    1
 INSA     1.000    2.000 735.432   0.200
;PRINT P1;< INSA    2
 INSA     3.000    3.000 305.508   0.400
;PRINT P1;< INSA    3
 INSA     6.000    5.000 131.093   0.800
;PRINT P1;< INSA    4
 INSA    11.000    8.000 987.771   0.100
;PRINT P1;< INSA    5
 INSA    19.000   13.000 882.219   0.200
;PRINT P1;< INSA    6
 FINISH; < TOOT .SCR


CONTINUED

And the user wished to try TTY: input as well:

.r mixpla
File 1 (begin time) → q
File 2 (begin time) → toot 40
File 3 (begin time) → tty:
TTY Input 1 activated.
File 3 (begin time) → 
Output File (<cr>=TEST.PLA) → 
TTY Input 1 → nutix←47;
TTY Input 1 → ∂ this is a comment;
TTY Input 1 → play;
TTY Input 1 → ttysimp 0 10 a b c;
TTY Input 1 → play;
TTY Input 1 → ttysimp 100 10 a c b;
Delete multiple calls on REVERB ? y
TTY Input 1 → finish;

End of SAIL execution

↑C

The outputted TEST.PLA would be:

TEST.PLA:


RECORD WVE RAN;
nptix←256;
common f g h i;
FUNC EXMP1.FUN[INS,MUS]; 
COMMON TOOT INSA;< TOOT .SCR  --  RANDOM NUMBER=     1
NUTIX←47;
∂ THIS IS A COMMENT;
PLAY;

tTYSIMP 0 10 A B C;
f  -10+(-20+31)*2 10;
f   23.000   (9↑(1-1)*10);
REVRB   40.000   10.000   0.000   0.000   0.000   0.000
;PRINT P1;< REVRB   1
INSA   40.000   1.000 900.787   0.100    F1   0.000   0.000   0.000   0.000  45.000
         1.000   0.050    F6
;PRINT P1;< INSA    1
f   41.000   1;
f ()  ,-()	;
f (1-)   ()-;
INSA   41.000   2.000 735.432   0.200
;PRINT P1;< INSA    2
INSA   43.000   3.000 305.508   0.400
;PRINT P1;< INSA    3
f   44.164   20+log(1);
Trem   46.000   21 14  485.8 2  14 .5  30  20  1.4,"inharm",.007, 0, "trplfm","dipp", .03;
INSA   46.000   5.000 131.093   0.800
;PRINT P1;< INSA    4
Quad   51.000   14  242.9   1.6  env,"inharm", loop_ch1   .005    0;
INSA   51.000   8.000 987.771   0.100
;PRINT P1;< INSA    5
INSA   59.000   13.000 882.219   0.200
;PRINT P1;< INSA    6
Trem   78.000   21 7  296.1   2  7 .5  300  15  1.6 ,"harm",.007, 0, "Trplfm","envl", .02;
Trem   84.000   14 7  199.26  2  7 .5  0  15  1.6 ,"inharm",.004, 0, "Trplfm",1 .06;

∂ end cycle 1 (P0);
mot   99.000   21 a/2.18 7 .6  60  3  1.2  0 ,"harm", .009 0, "trplfm", "tuneRhy", 
	"tune", "louder", 1 .03;
tTYSIMP   110.000   10 A C B;
mot   116.500   17.5 268.18 7 .8  120 3  1.2 1 ,"harm", .01  0, "trplfm", "tuneRhy", 
	"tune", "louder", "envl", .05;
entr   126.000   21   880   14 .8  0 3  1.2 1.8  1,"inharm", .015  0, "randfm", 
	"tunerhy", "tune", "louder", 2  .04;
f   154.164   (2+sin(90))↑.5;
f   156.093   10;
f   166.113   1;
entr   178.500   21 462.33  14  1  180 3  1.2 1.8  1,"inharm", .015  0, "randfm", 
	"tunerhy", "tune", "softer", 2  .04;
∂ end cycle 4 (I1);
FINISH;